package com.minaClient.utils;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.Properties;


@SuppressWarnings("static-access")
public class PropertiesUtil {
	
    private static Properties properties = new Properties();  
    private static String CONFIG = "/setting.properties";  
    private static InputStream is = PropertiesUtil.class.getResourceAsStream(CONFIG);  
     
    public static String CLIENT_SEND_HOST; 
    
    public static int RECIVE_SEND_PORT; 
    public static int CLIENT_MAIN_PORT;  
    static {  
        try {  
                properties.load(is);  
                InetAddress ia= InetAddress.getLocalHost();
                String localname=ia.getHostName();
                String localip=ia.getHostAddress();
              //  System.out.println("本机名称是："+ localname);
                //System.out.println("本机的ip是 ："+localip);
            CLIENT_SEND_HOST =localip==null? properties.getProperty("mina.clientsend.host"):localip; 
            RECIVE_SEND_PORT = Integer.parseInt(properties.getProperty("mina.recive_send.port"));  
            CLIENT_MAIN_PORT =Integer.parseInt(properties.getProperty("mina.main.port"));  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }  

}
